home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2002 November / SGI Freeware 2002 November - Disc 3.iso / dist / fw_qt3.idb / usr / freeware / Qt / examples / demo / display.h.z / display.h
C/C++ Source or Header  |  2002-04-08  |  2KB  |  93 lines

  1. /****************************************************************************
  2. ** $Id:  qt/display.h   3.0.3   edited Oct 12 12:18 $
  3. **
  4. ** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
  5. **
  6. ** This file is part of an example program for Qt.  This example
  7. ** program may be used, distributed and modified without limitation.
  8. **
  9. *****************************************************************************/
  10.  
  11. #ifndef DISPLAY_H
  12. #define DISPLAY_H
  13.  
  14. #ifndef QT_H
  15. #include <qwidget.h>
  16. #include <qframe.h>
  17. #endif // QT_H
  18.  
  19. class QTimer;
  20. class QDial;
  21. class QLCDNumber;
  22. class QProgressBar;
  23. class QSpinBox;
  24. class Screen;
  25. class Curve;
  26.  
  27. class DisplayWidget : public QWidget {
  28.     Q_OBJECT
  29. public:
  30.     DisplayWidget( QWidget *parent=0, const char *name=0 );
  31.  
  32.     void run();
  33.     void stop();
  34.  
  35. protected:
  36.     virtual void showEvent( QShowEvent * );
  37.     virtual void hideEvent( QHideEvent * );
  38.  
  39. private slots:
  40.     void tick();
  41.  
  42. private:
  43.     Screen *screen;
  44.     QDial *dial;
  45.     Curve *curve;
  46.     QSpinBox *spin;
  47.     QLCDNumber *lcd;
  48.     int lcdval;
  49.     QProgressBar *bar;
  50.     int tbar;
  51.     QTimer *timer;
  52. };
  53.  
  54. class Screen : public QFrame {
  55.     Q_OBJECT
  56. public:
  57.     enum { MaxSamples = 500, Range = 100, FrameWidth = 3 };
  58.     Screen( QWidget *parent=0, const char *name=0 );
  59.  
  60.     void animate();
  61.  
  62. public slots:
  63.     void setStep( int s );
  64.  
  65. protected:
  66.     virtual void drawContents( QPainter * );
  67.  
  68. private:
  69.     int yval[ MaxSamples ];
  70.     int pos0; // buffer pointer for x == 0
  71.     int t0;   // time parameter at x == 0
  72.     int step;
  73. };
  74.  
  75. class Curve : public QFrame {
  76.     Q_OBJECT
  77.     enum { FrameWidth = 3, Radius = 100 };
  78. public:
  79.     Curve( QWidget *parent=0, const char *name=0 );
  80.  
  81.     void animate();
  82. public slots:
  83.     void setFactor( int );
  84.  
  85. protected:
  86.     virtual void drawContents( QPainter * );
  87.  
  88. private:
  89.     int shift, n;
  90. };
  91.  
  92. #endif // PLOT_H
  93.